home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / winterp-1.13 / contrib / xmu / GNU / xmenu-demo.el < prev    next >
Encoding:
Text File  |  1991-10-06  |  2.8 KB  |  77 lines

  1. ; -*-Emacs-Lisp-*-
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;
  4. ; File:         xmenu-demo.el
  5. ; RCS:          $Header: $
  6. ; Description:  Example of xmenu Elisp interface...
  7. ; Author:       Richard Hess, Consilium.
  8. ;        Updated for gnuvo by Niels Mayer.
  9. ; Created:      Sat Oct  5 23:24:49 1991
  10. ; Modified:     Sat Oct  5 23:43:05 1991 (Niels Mayer) mayer@hplnpm
  11. ; Language:     Emacs-Lisp
  12. ; Package:      N/A
  13. ; Status:       X11r5 contrib tape release
  14. ;
  15. ; WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  16. ; XLISP version 2.1, Copyright (c) 1989, by David Betz.
  17. ;
  18. ; Permission to use, copy, modify, distribute, and sell this software and its
  19. ; documentation for any purpose is hereby granted without fee, provided that
  20. ; the above copyright notice appear in all copies and that both that
  21. ; copyright notice and this permission notice appear in supporting
  22. ; documentation, and that the name of Hewlett-Packard and David Betz not be
  23. ; used in advertising or publicity pertaining to distribution of the software
  24. ; without specific, written prior permission.  Hewlett-Packard and David Betz
  25. ; make no representations about the suitability of this software for any
  26. ; purpose. It is provided "as is" without express or implied warranty.
  27. ;
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29.  
  30. ; +---------------------------------------------------------------------------
  31. ;  WHO:    Richard Hess                    CORP:   Consilium
  32. ;  TITLE:  Staff Engineer                  VOICE:  [415] 691-6342
  33. ;      [ X-SWAT Team:  Special Projects ]  USNAIL: 640 Clyde Court
  34. ;  UUCP:   ...!uunet!cimshop!rhess                 Mountain View, CA 94043
  35. ; +---------------------------------------------------------------------------
  36.  
  37. (require 'xmenu-lib)
  38.  
  39. (cond
  40.  ;; special version of xmenu-buffer-select for gnuvo (based on 18.44.2)
  41.  ((string= emacs-version "18.44.2")    
  42. (defun xmenu-buffer-select (&optional arg)
  43.   "switch-to-buffer using xmenu..."
  44.   (interactive)
  45.   (let* ((buflist (mapcar (function buffer-name) (buffer-list)))
  46.      (xpick   (xmenu "Select Buffer" (xmenu-buffer-filter buflist)))
  47.      )
  48.     (if xpick
  49.     (set-buffer (find-buffer xpick)))
  50.       ))
  51. )
  52.   ;; normal gnuemacs version of xmenu-buffer-select
  53.   (t
  54. (defun xmenu-buffer-select (&optional arg)
  55.   "switch-to-buffer using xmenu..."
  56.   (interactive)
  57.   (let* ((buflist (mapcar (function buffer-name) (buffer-list)))
  58.      (xpick   (xmenu "Select Buffer" (xmenu-buffer-filter buflist)))
  59.      )
  60.     (if xpick
  61.     (switch-to-buffer xpick))
  62.     ))
  63. )
  64. )
  65.  
  66. (defun xmenu-buffer-filter (l)
  67.   "remove private buffers who's name begins with a SPACE..."
  68.   (if l
  69.     (if (string-match "^ " (car l))    ;; REF:  (string-match "\*$" (car l))
  70.     (xmenu-buffer-filter (cdr l))
  71.       (cons (car l) (xmenu-buffer-filter (cdr l))))))
  72.  
  73.  
  74. ; (define-key global-map "\^x\^b" 'xmenu-buffer-select)
  75.  
  76. ;; ----<eof>
  77.